#!/bin/sh

# srcdir is the directory where this script resides
srcdir="$(cd `dirname "$0"` && pwd)"
progname="`basename "$0"`"
. ${srcdir}/env.sh

printf "${progname}: starting to extract URLs...\n" > /dev/tty
$grep -e '<a style' | $sed -e 's/^.*href="//' |
$awk '
	# URL ends in FS
	BEGIN {
		FS="\"" 
	}
	
	# we care only for the part before the first FS character
	{
		print $1
	}
' |
# urls are relative, so we construct URIs here
$sed -e 's|^|si http://www.studenteninserate.at/wohnungsboerse/|'
printf "${progname}: URL extraction done.\n" > /dev/tty
